xen/pvhsim: fix cpu onlining
authorJuergen Gross <jgross@suse.com>
Wed, 23 Oct 2019 15:53:52 +0000 (16:53 +0100)
committerGeorge Dunlap <george.dunlap@citrix.com>
Wed, 23 Oct 2019 15:53:52 +0000 (16:53 +0100)
commit529a76fba40e34037e9473d9f461c39604eb34f9
treef76b15188020bbbbdcd38b9db99c7dffd8dfc517
parent9257c218e56e9902b78662e5852d69329b9cc204
xen/pvhsim: fix cpu onlining

Since commit 8d3c326f6756d1 ("xen: let vcpu_create() select processor")
the initial processor for all pv-shim vcpus will be 0, as no other cpus
are online when the vcpus are created. Before that commit the vcpus
would have processors set not being online yet, which worked just by
chance.

When the pv-shim vcpu becomes active it will have a hard affinity
not matching its initial processor assignment leading to failing
ASSERT()s or other problems depending on the selected scheduler.

Fix that by doing the affinity setting after onlining the cpu but
before taking the vcpu up. For vcpu 0 this is still in
sched_setup_dom0_vcpus(), for the other vcpus setting the affinity
there can be dropped.

Fixes: 8d3c326f6756d1 ("xen: let vcpu_create() select processor")
Reported-by: Sergey Dyasli <sergey.dyasli@citrix.com>
Tested-by: Sergey Dyasli <sergey.dyasli@citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: George Dunlap <george.dunlap@citrix.com>
xen/arch/x86/pv/shim.c
xen/common/schedule.c